-
Notifications
You must be signed in to change notification settings - Fork 3.7k
solution #4051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
solution #4051
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
I am requesting changes because your submission doesn't fully meet the task requirements and violates a couple of checklist items. You've done a great job creating the Sum component, but there are a few key areas that need correction.
First, in src/App.jsx, the requirement to test default props was not met. Instead of omitting props to let the defaults apply, you passed them explicitly (e.g., <Sum a={10} b={0} />). To fix this, you should remove the prop you aren't testing, for example: <Sum a={10} />.
Additionally, there are two style guide violations:
- In
src/components/Sum/Sum.jsx, you need to use string interpolation for the output as per [CHECKLIST ITEM #2]:{`Sum of ${a} and ${b} is ${a + b}`}. - In
src/App.jsx, all<Sum />components should be written on a single line as they have fewer than three attributes [CHECKLIST ITEM #1].
Please address these points, and your solution will be ready for approval!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
src/components/Sum/Sum.jsx
Outdated
| import React from 'react'; | ||
|
|
||
| export const Sum = ({a = 0, b = 0}) => ( | ||
| <p>Sum of {a} and {b} is {a + b}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #2: 'Use string interpolation inside tag content'. While your current approach is valid, the task specifically requests using a template literal for the text content.
src/App.jsx
Outdated
| <Sum | ||
| a={2} | ||
| b={3} | ||
| /> | ||
| <Sum | ||
| a={-5} | ||
| b={5} | ||
| /> | ||
| <Sum | ||
| a={10} | ||
| b={0} | ||
| /> | ||
| <Sum | ||
| a={0} | ||
| b={5} | ||
| /> | ||
| <Sum | ||
| a={0} | ||
| b={0} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This violates checklist item #1: 'If you have < 3 attribues on a tag and the values are short write the tag in one line (to make it easier to write and read)'. All <Sum /> components in this file should be written on a single line.
src/App.jsx
Outdated
| <Sum | ||
| a={10} | ||
| b={0} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requirement is to pass only a = 10 here. The b prop should be omitted entirely to allow its default value from the Sum component to be used.
src/App.jsx
Outdated
| <Sum | ||
| a={0} | ||
| b={5} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the requirements, this Sum component should only receive the b prop. The a prop should be omitted so its default value is used.
src/App.jsx
Outdated
| <Sum | ||
| a={0} | ||
| b={0} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Sum component should be called without any props to test the default values for both a and b, as specified in the task description.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Excellent work on this iteration! I am happy to approve your solution as you've successfully addressed all the feedback from the previous review. The Sum component is implemented perfectly, and all requirements are now met. As a final suggestion for keeping your code professional, remember to remove instructional comments from files like src/App.jsx before finalizing your work. This is a minor point but a great habit to build. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| {/* Replace paragraphs with Sum componets */} | ||
| {/* And remove commented lines :) */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on the implementation! As a final touch, it's good practice to remove instructional comments like these from your code once you've completed the task.
DEMO LINK